# 父类
class Person(object):
    def __init__(self, name, age):
        self.name = name
        self.age = age
    def eat(self):
        print("%s 吃饭" %self.name)
# 继承Person类
class Man(Person):
    def __init__(self, name, age, goatee):
        super().__init__(name, age)  # 调用父类构造方法
        # Person.__init__(self, name, age)
        # 添加新的属性
        self.goatee = goatee
    # 添加新的方法
    def playgame(self):
        print("打游戏")
class Woman(Person):
    # 添加自己方法
    def watchShow(self):
        print("看电视")
    # 覆写父类方法
    def eat(self):
        super().eat()  # 调用父类方法
        print("%s 还要吃减肥餐"%self.name)
m1 = Man("heyi", 25, 2)
print(m1.name)
m1.eat()  # 可直接调用父类方法,已继承
w1 = Woman("yaozhen",25)
w1.eat()

